@extends("web.layout.common_login")
@section("title")
    绑定
@endsection
@section('style')
@endsection
@section('content')
    <div class="bind">
        <div class="bind_box">
            <h2>继续以完成第三方帐号绑定</h2><br>
            <div style="line-height: 48px;padding:0 0 20px 0;">
                <img src="/images/icon_wechat.png" />
                <i class="bi bi-arrow-left-right" style="font-size: 20px;color: #b9b9b9;padding: 5px 30px"></i>
                <img src="/images/icon_wechat.png" />
            </div>
            你已通过 微信 授权，完善以下登录信息即可完成绑定
        </div>
        <form action="{{ route('web.binding',['account'=>request('domain')]) }}" method="post" id="normal_form">
            @csrf
            <div class="mb-3">
                <input type="hidden" name="type" value="1">
                <input type="hidden" name="openid" value="{{request('openid')}}" />
                <input type="hidden" name="token" value="{{request('token')}}">
                <input type="text" name="username" class="form-control"  placeholder="请输入用户名" required>
            </div>
            <div class="mb-3">
                <input type="password" name="password" class="form-control"  placeholder="请输入密码" required>
            </div>
            <div class="submit">
                <button type="button" id="submit">登录并绑定已有帐号</button>
            </div>
        </form>
    </div>
@endsection
@section('script')
    <script>
        $("#submit").click(function(){
            var that;
            if($("#normal").is(":hidden")){
                that = $('#message_form')
            }else{
                that = $('#normal_form');
            }
            var data = that.serialize();
            var action = that.attr('action');
            $.post(action,data,function(res){
                var icon = 5;
                if(res.error == 0){
                    icon = 6;
                }
                layer.msg(res.msg, {icon: icon},function(){
                    if(res.error == 0){
                        window.location.href = '{{route("web.success")}}';
                    }
                });
            })
        });
    </script>
@endsection


